package chat.application.client;

public class uiMain extends javax.swing.JFrame {

    private boolean _loginVerify;
    public uiMain(boolean result) {
        initComponents();
        _loginVerify = result;
        jButton1.setText("something");
    }

    @SuppressWarnings("unchecked")
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tbpaneMain = new javax.swing.JTabbedPane();
        intFrameRoom1 = new javax.swing.JInternalFrame();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAreaRoomChat = new javax.swing.JTextArea();
        txtAreaRoomChat.setLineWrap(true);
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("frMain"); // NOI18N

        tbpaneMain.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        tbpaneMain.setName("tbPaneMain"); // NOI18N

        intFrameRoom1.setVisible(true);

        txtAreaRoomChat.setColumns(20);
        txtAreaRoomChat.setRows(5);
        txtAreaRoomChat.setName("txtOutput"); // NOI18N
        jScrollPane1.setViewportView(txtAreaRoomChat);

        javax.swing.GroupLayout intFrameRoom1Layout = new javax.swing.GroupLayout(intFrameRoom1.getContentPane());
        intFrameRoom1.getContentPane().setLayout(intFrameRoom1Layout);
        intFrameRoom1Layout.setHorizontalGroup(
            intFrameRoom1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(intFrameRoom1Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 426, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 150, Short.MAX_VALUE))
        );
        intFrameRoom1Layout.setVerticalGroup(
            intFrameRoom1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
        );

        tbpaneMain.addTab("tab1", intFrameRoom1);

        jButton1.setText("Send");
        jButton1.setName("btnSendMessage"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jTextArea2.setName("txtInput"); // NOI18N
        jScrollPane2.setViewportView(jTextArea2);

        jButton2.setText("Send To...");
        jButton2.setName("btnSendTo"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap(36, Short.MAX_VALUE)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane2))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(tbpaneMain, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tbpaneMain, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        txtAreaRoomChat.append(String.valueOf(_loginVerify + "\n"));
        
        //used for testing
        String xmlRecords =
        "<data>" +
        " <employee>" +
        "   <name>John</name>" +
        "   <title>Manager</title>" +
        " </employee>" +
        " <employee>" +
        "   <name>Sara</name>" +
        "   <title>Clerk</title>" +
        " </employee>" +
        "</data>";
        XmlParser parser = new XmlParser();
        String messageType = parser.getType(xmlRecords);
        txtAreaRoomChat.append(messageType + "\n");
    }//GEN-LAST:event_jButton1ActionPerformed

    public static void main(String args[]) {

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                
            }
            
        });
        
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JInternalFrame intFrameRoom1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTabbedPane tbpaneMain;
    private javax.swing.JTextArea txtAreaRoomChat;
    // End of variables declaration//GEN-END:variables

    
//Test function for adding multiple tabs dynamically
    public void addRoom()
    {
        //declare new components
        javax.swing.JInternalFrame newIFrame = new javax.swing.JInternalFrame();
        
        javax.swing.JTextArea newTextArea = new javax.swing.JTextArea();
        
        //add them to tab pane on form
        tbpaneMain.addTab("Test2", newIFrame);
        newIFrame.add(newTextArea);
    }

}
